/**
 * sets the given language to cookie an reloads page
 * @param 		string		language
 */
function setLanguage(language){
	cookie('LANGUAGE',null);
	cookie('LANGUAGE', language);
	document.location.href=indexUrl;			
}


/**
 * reloads the content of given div 
 * @param 		string		url
 * @param 		string		div
 */
function loadDiv(ajaxUrl, params, div, callback){
	$.ajax({
		url: ajaxUrl,
		type: 'POST',
		dataType: 'html',
		data: params,
		success: function(response){
			$('#' + div).fadeOut(500, function(){
				$(this).html(response);
				$(this).fadeIn(500);
				if (callback != null && typeof(callback) == 'function')
					callback();
			});
			
		}
	});
	
}

/**
 * copies the text to field with given id
 * @param 		string		toId
 * @param 		string		value
 */
function copyText(toId, value){
	$('#' + toId).val(value);
}


function load(){
	loadDiv(testUrl, null, 'content');
}
